package org.jsrml.core.base.service;

import org.hibernate.Criteria;
import org.jsrml.common.persistence.BaseDao;
import org.jsrml.core.base.entity.Admin;
import org.jsrml.core.base.qo.AdminQO;
import org.jsrml.core.purchaser.command.SaveAdminCo;
import org.jsrml.core.purchaser.exception.PurchaserException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class AdminService extends BaseDao<Admin, AdminQO> {
	
	
	@Transactional(rollbackFor = PurchaserException.class)
	public Admin create(SaveAdminCo command) throws PurchaserException{
		Admin admin = new Admin();
		admin.create(command);
		save(admin);
		return admin;
	}

	@Override
	protected Criteria buildCriteria(Criteria criteria, AdminQO qo) {
		return criteria;
	}

	@Override
	protected Class<Admin> getEntityClass() {
		return Admin.class;
	}
	

	
}
